{extend name="admin@public/base_content" /}
{block name="body">}
<body>
{include file="admin@public/common" /}
<div class="container-fluid larry-wrapper">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane" action="{:url('')}">
                    <div class="layui-form-item">
                        <label class="layui-form-label">上级栏目</label>
                        <div class="layui-input-inline">
                            <select name="parent_id">
                                <option value="0">顶级导航</option>
                                {foreach name="navList" item="vo"}
                                <option value="{$vo.id}" {if condition="$vo.id eq $info.parent_id"}selected{/if}>{$vo.cname}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">菜单名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" value="{$info.name|default=''}" required jq-verify="required" jq-error="请输入菜单名称" placeholder="请输入菜单名称" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">地址类型</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="type" lay-filter="type" {eq name="info.type" value="1"}checked{/eq} title="地址" value="1" checked/>
                            <input type="radio" name="type" lay-filter="type" {eq name="info.type" value="2"}checked{/eq} title="栏目" value="2" />
                        </div>
                    </div>
                    <div class="layui-form-item" id="dizhi"{eq name="info.type" value="2"}style="display: none;"{/eq}>
                        <label class="layui-form-label">地址url</label>
                        <div class="layui-input-block">
                            <input type="text" name="href1" value="{$info.href|default='/'}" required jq-verify="required" jq-error="请输入" placeholder="请输入" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item" id="lanmu" {neq name="info.type" value="2"}style="display: none;"{/neq}>
                        <label class="layui-form-label">栏目列表</label>
                        <div class="layui-input-inline">
                            <select name="href2">
                                <option value="__ROOT__/">首页</option>
                                {foreach name="categoryList" item="vo"}
                                <option value="{$vo.curl}" {if condition="$vo.curl eq $info.href"}selected{/if}>{$vo.cname}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">打开方式</label>
                        <div class="layui-input-block">
                            <input type="radio" name="target" {eq name="info.target" value=""}checked{/eq} title="默认" value="" checked />
                            <input type="radio" name="target" {eq name="info.target" value="_blank"}checked{/eq} title="新窗口打开" value="_blank" />
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="status" {eq name="info.status" value="1"}checked{/eq} title="显示" value="1" checked />
                            <input type="radio" name="status" {eq name="info.status" value="2"}checked{/eq} title="关闭" value="2" />
                        </div>
                    </div>
                    <div class="layui-input-block">
                        <input type="hidden" name="nav_id" type="hidden" value="{$navInfo.nav_id|default=''}">
                        <input type="hidden" name="id" value="{$info.id|default=''}">
                        <button class="layui-btn" jq-submit lay-filter="submit" jq-tab="true">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </form>
            </section>
        </div>
    </div>
</div>
</body>
{/block}
{block name="script"}
<!--kingeditor编辑器开始-->
<script>
    //document.domain = 'domain.com';
    KindEditor.ready(function(K) {
        window.editor = K.create('.king_content', {
            allowFileManager : true,
            langType : 'zh-CN',
            autoHeightMode : true,
            afterBlur: function () { this.sync(); },
        });
    });
</script>
<!--kingeditor编辑器结束-->
<script>
    layui.use('myform', function(){
        var $ = layui.jquery,
                form = layui.form();
        //各种基于事件的操作，下面会有进一步介绍
        //自定义
        form.on('radio(type)', function(data){
            if (data.value==1){
                $('#dizhi').show();
                $('#lanmu').hide();
            }else{
                $('#dizhi').hide();
                $('#lanmu').show();
            }
        });
    });
</script>
{/block}